package com.leetcode.No1784;

/**
 * @program: leetcode
 * @description: 检查二进制字符串字段
 * @author: wangzhihua
 * @date: 2022-10-12
 */
public class Solution {
	public boolean checkOnesSegment(String s) {
		int count = 0;
		int len = s.length();
		for (int i = 0; i < len; ) {
			int tempCount = 0;
			while (i < len && s.charAt(i++) == '1') {
				++tempCount;
			}
			count += tempCount > 0 ? 1 : 0;
		}

		return count < 2;
	}
}
